﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MethodWorx.CMS.Content;
using System.Data.Linq.Mapping;
using System.Data.Linq;
using MethodWorx.Core.DomainModel;

namespace MethodWorx.CMS.Linq
{
    [Table(Name="dbo.ContentTemplate")]
    public class LinqContentTemplate : ContentTemplate, IPersistable
    {
        private EntitySet<LinqContentTemplateProperty> proxyProperties;

        public LinqContentTemplate() : 
            base((ct) => ((LinqContentTemplate)ct).ProxyProperties)
        {
            this.proxyProperties = new EntitySet<LinqContentTemplateProperty>();
        }

        [Column(IsPrimaryKey=true, UpdateCheck=UpdateCheck.Never)]
        public new Guid Id { get { return base.Id; } set { base.Id = value; } }
        [Column(UpdateCheck = UpdateCheck.Never)]
        public new string Name { get { return base.Name; } set { base.Name = value; } }
        [Column(UpdateCheck = UpdateCheck.Never)]
        public new string Description { get { return base.Description; } set { base.Description = value;} } 
        #region Proxy Property For Deleted
        [Column(UpdateCheck=UpdateCheck.Never)]
        public new bool Deleted { get { return base.Deleted; } set { base.Deleted = value; } }
        #endregion
      



        [Association(Name = "ContentTemplateProperties", OtherKey = "ContentTemplateId", ThisKey = "Id", Storage = "proxyProperties")]
        public EntitySet<LinqContentTemplateProperty> ProxyProperties
        {
            get { return this.proxyProperties; }
            set { this.proxyProperties.Assign(value); }
        }
    }
}
